MintedNormalTGE
MintedNormalTGE
Note sale for JOT
registry
contract Registry registry
pool
address pool
Pool address which this sale belongs to
hasStarted
bool hasStarted
token
address token
The token being sold
currency
address currency
The token being sold
firstNoteTokenMintedTimestamp
uint256 firstNoteTokenMintedTimestamp
Timestamp at which the first asset is collected to pool
_currencyRaised
uint256 _currencyRaised
Amount of currency raised
tokenRaised
uint256 tokenRaised
Amount of token raised
totalCap
uint256 totalCap
Target raised currency amount
minBidAmount
uint256 minBidAmount
Minimum currency bid amount for note token
initialAmount
uint256 initialAmount
openingTime
uint256 openingTime
_currencyRaisedByInvestor
mapping(address => uint256) _currencyRaisedByInvestor
isOpen
function isOpen() public view returns (bool)
initialize
function initialize(contract Registry _registry, address _pool, address _token, address _currency, uint256 _openingTime) public
securitizationPoolRestricted
modifier securitizationPoolRestricted()
smpRestricted
modifier smpRestricted()
currencyRaisedByInvestor
function currencyRaisedByInvestor(address investor) public view returns (uint256)
This function returns the amount of currency raised by a specific investor.
Parameters
Name | Type | Description |
---|---|---|
investor | address | The address of the investor. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount of currency raised by the investor. |
setMinBidAmount
function setMinBidAmount(uint256 _minBidAmount) external
Function to set minimum bid amount
Parameters
Name | Type | Description |
---|---|---|
_minBidAmount | uint256 | The new minimum bid amount |
setHasStarted
function setHasStarted(bool _hasStarted) public
_This function allows the owner or securitization manager to set whether the TGE has started.
Requirements:
- The caller must have either OWNERROLE or be the SecuritizationManager.
Parameters
Name | Type | Description |
---|---|---|
_hasStarted | bool | A boolean indicating if the TGE has started. |
setOpeningTime
function setOpeningTime(uint256 _openingTime) external
_Allows the owner or manager to set the opening time for the token sale.
Requirements:
- The caller must have either OWNERROLE or be the securitization manager.
Parameters
Name | Type | Description |
---|---|---|
_openingTime | uint256 | The timestamp when the token sale will start. |
onRedeem
function onRedeem(uint256 currencyAmount) public virtual
Function for redeeming currency from the TGE contract. The caller must be the Note token vault, and the amount of raised currency is reduced by the specified amount.
Parameters
Name | Type | Description |
---|---|---|
currencyAmount | uint256 | Amount to be deducted from _currencyRaised. |
getTokenRemainAmount
function getTokenRemainAmount() public view returns (uint256)
Returns the amount of tokens remaining in this contract's balance.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The number of tokens remaining in this contract's balance. |
getTokenPrice
function getTokenPrice() public view returns (uint256)
Calculates the token price for a given pool and token.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The calculated token price. |
getTokenAmount
function getTokenAmount(uint256 currencyAmount) public view returns (uint256)
Calculates the amount of tokens that can be minted for a given currency amount.
Parameters
Name | Type | Description |
---|---|---|
currencyAmount | uint256 | The amount of currency to convert into tokens. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The number of tokens that can be minted from the provided currency amount. |
_preValidatePurchase
function _preValidatePurchase(address beneficiary, uint256 currencyAmount, uint256 tokenAmount) internal view virtual
_Validates that the purchase meets all requirements before minting tokens.
Requirements:
- Sale must have started.
- Currency amount should be greater than or equal to minBidAmount.
- Beneficiary address cannot be zero.
- Token amount cannot be 0.
- Currency amount should not exceed the total cap._
Parameters
Name | Type | Description |
---|---|---|
beneficiary | address | The address receiving the tokens. |
currencyAmount | uint256 | Amount of currency being used to purchase. |
tokenAmount | uint256 | Number of tokens being minted. |
_deliverTokens
function _deliverTokens(address beneficiary, uint256 tokenAmount) internal
This function mints new tokens to an address and sets up the opening block timestamp if this is the first note token being minted.
Parameters
Name | Type | Description |
---|---|---|
beneficiary | address | The address that will receive the newly minted tokens. |
tokenAmount | uint256 | The amount of tokens to be minted. |
_claimPayment
function _claimPayment(address payee, uint256 currencyAmount) internal
This internal function is used to claim payment. It transfers the specified amount of currency from the payee to the contract address using transferFrom method of ERC20 standard.
Parameters
Name | Type | Description |
---|---|---|
payee | address | The address that will receive the payment. |
currencyAmount | uint256 | The amount of currency being transferred. |
_forwardFunds
function _forwardFunds(address beneficiary, uint256 currencyAmount) internal
Transfers currencyAmount
tokens to beneficiary
address.
Requires that the contract has enough balance in terms of ERC20 token.
Parameters
Name | Type | Description |
---|---|---|
beneficiary | address | The address where the currency will be sent. |
currencyAmount | uint256 | The amount of currency to send. |
currencyRaised
function currencyRaised() public view virtual returns (uint256)
Returns the total amount of currency that has been raised so far.
The _currencyRaised variable holds this information.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 - Total amount of currency raised in wei. |
isDistributedFully
function isDistributedFully() public view returns (bool)
Checks if the total amount of currency raised is equal to the total cap.
This comparison is made between the _currencyRaised variable and the totalCap variable.
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool - True if the total amount of currency raised equals the total cap, False otherwise. |
getCurrencyRemainAmount
function getCurrencyRemainAmount() public view virtual returns (uint256)
Calculates the remaining amount of currency available for purchase.
This calculation subtracts the _currencyRaised variable from the totalCap variable.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 - Remaining amount of currency in wei that can still be purchased. |
setTotalCap
function setTotalCap(uint256 cap_) external
Allows owner or manager to set total cap for minting
Parameters
Name | Type | Description |
---|---|---|
cap_ | uint256 | The new total cap |
_setTotalCap
function _setTotalCap(uint256 cap) internal
_Set the total cap of the token sale. Requirements:
- The new cap must be greater than zero.
- The new cap must be equal to or higher than the amount that has already been raised. Emits an {UpdateTotalCap} event._
totalCapReached
function totalCapReached() public view returns (bool)
Checks if the total amount of currency raised is greater than or equal to the total cap
isUnderTotalCap
function isUnderTotalCap(uint256 currencyAmount) public view returns (bool)
Checks if the sum of the current currency raised and the specified currency amount is less than or equal to the total cap
setInitialAmount
function setInitialAmount(uint256 _initialAmount) external
Setup initial amount currency raised for JOT condition
Parameters
Name | Type | Description |
---|---|---|
_initialAmount | uint256 | Expected minimum amount of JOT before SOT start |
buyTokens
function buyTokens(address payee, address beneficiary, uint256 currencyAmount) public returns (uint256)
Function to buy tokens from the TGE contract
Parameters
Name | Type | Description |
---|---|---|
payee | address | The address that receives payment |
beneficiary | address | The address that receives the purchased tokens |
currencyAmount | uint256 | The amount of currency to be paid by the investor |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | tokenAmount The number of tokens bought by the investor |